<div class="btn-group">

  <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button" id="dropdownMenu_<%= file_set.id %>" aria-haspopup="true">
    <span class="sr-only">Press to </span>
    Select an action
    <span class="caret" aria-hidden="true"></span>
  </button>

  <ul role="menu" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu_<%= file_set.id %>">

  <% if can?(:edit, file_set.id) %>
    <li role="menuitem" tabindex="-1">
      <%= link_to 'Edit', edit_polymorphic_path([main_app, file_set]),
        { title: "Edit #{file_set}" } %>
    </li>

    <li role="menuitem" tabindex="-1">
      <%= link_to 'Versions',  edit_polymorphic_path([main_app, file_set], anchor: 'versioning_display'),
        { title: "Display previous versions" } %>
    </li>
  <% end %>

  <% if can?(:destroy, file_set.id) %>
    <li role="menuitem" tabindex="-1">
      <%= link_to 'Delete', polymorphic_path([main_app, file_set]),
        method: :delete, title: "Delete #{file_set}",
        data: {confirm: "Deleting #{file_set} from #{application_name} is permanent. Click OK to delete this from #{application_name}, or Cancel to cancel this operation"} %>
    </li>
  <% end %>

  <% if can?(:read, file_set.id) %>
    <li role="menuitem" tabindex="-1">
      <%= link_to 'Download', main_app.download_path(file_set),
        title: "Download #{file_set.to_s.inspect}", target: "_blank" %>
    </li>
  <% end %>

  </ul>
</div>


